/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #0f0f0f;
    --text-primary: #00ffaa;
    --text-secondary: #00cc88;
    --text-dim: #008866;
    --border-color: #00ffaa33;
    --accent-green: #00ffaa;
    --accent-red: #ff0000;
    --accent-yellow: #ffff00;
    
    /* 涨跌颜色模式变量 - 默认红涨绿跌 */
    --price-up: var(--accent-red);
    --price-down: var(--accent-green);
    --position-long: var(--accent-red);
    --position-short: var(--accent-green);
    --profit-color: var(--accent-red);
    --loss-color: var(--accent-green);
}

/* 反转涨跌颜色模式 - 红跌绿涨 */
body.color-mode-reversed {
    --price-up: var(--accent-green);
    --price-down: var(--accent-red);
    --position-long: var(--accent-green);
    --position-short: var(--accent-red);
    --profit-color: var(--accent-green);
    --loss-color: var(--accent-red);
}

body {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

/* Disclaimer Banner */
.disclaimer-banner {
    background-color: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.4);
    color: #ffa500;
    padding: 12px 2rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    backdrop-filter: blur(5px);
}

.disclaimer-banner strong {
    color: #ffbb33;
}

@media (max-width: 768px) {
    .disclaimer-banner {
        padding: 8px 1rem;
        font-size: 0.7rem;
        text-align: left;
        justify-content: flex-start;
    }
}

/* Header */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    left: 0;
    right: 0;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-green);
    text-shadow: 0 0 10px var(--accent-green);
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link,.nav-menu-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    position: relative;
}

.nav-link:hover,.nav-menu-item:hover,
.nav-link.active {
    color: var(--accent-green);
    text-shadow: 0 0 5px var(--accent-green);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-green);
    box-shadow: 0 0 5px var(--accent-green);
}

.github-link {
    display: flex;
    align-items: center;
}

.github-stars {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    padding: 2px 8px 2px 1px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    line-height: 1;
    height: 20px;
    box-sizing: border-box;
}

.github-link:hover .github-stars {
    border-color: var(--accent-green);
    box-shadow: 0 0 5px var(--accent-green);
}

#stars-count {
    min-width: 20px;
    text-align: center;
}

.github-stars svg {
    width: 14px;
    height: 14px;
    margin-left: 8px;
    margin-right: 3px;
    vertical-align: middle;
}

.btn-waitlist {
    background-color: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.btn-waitlist:hover {
    background-color: var(--accent-green);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--accent-green);
}

/* Ticker */
.ticker-wrapper {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    padding: 0.8rem 0;
    width: 100%;
    max-width: 100vw;
}

.ticker-content {
    display: flex;
    gap: 3rem;
    animation: scroll-ticker 30s linear infinite;
    width: fit-content;
}

@keyframes scroll-ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.ticker-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;
}

.crypto-name {
    color: var(--text-dim);
    font-weight: bold;
}

.crypto-price {
    color: var(--accent-green);
    font-weight: bold;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Chart Section */
.chart-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    position: relative;
    min-height: 500px;
    max-width: 100%;
    overflow: hidden;
}

/* 资产曲线图表区域 - 占据第一行 */
.chart-section:first-child {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

/* AI 决策区域 - 占据第二行，跨两列 */
.chart-section:nth-child(2) {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.decision-title {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.decision-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.decision-time {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.decision-iteration {
    color: var(--accent-green);
    font-size: 0.9rem;
    font-weight: bold;
}

/* Chart Container */
.chart-container {
    height: 400px;
    position: relative;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
}

.chart-container canvas {
    max-height: 100%;
    max-width: 100%;
}

.chart-title {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.timeframe-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.timeframe-select:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 5px var(--border-color);
}

.timeframe-select:focus {
    outline: none;
    border-color: var(--accent-green);
}

.decision-container {
    height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    max-width: 100%;
    word-wrap: break-word;
    word-break: break-word;
}

.decision-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.decision-text {
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Markdown 内容样式 */
.markdown-content {
    white-space: normal;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: var(--accent-green);
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: bold;
}

.markdown-content h1 {
    font-size: 1.4rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
}

.markdown-content h2 {
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

.markdown-content h3 {
    font-size: 1.1rem;
}

.markdown-content h4 {
    font-size: 1rem;
}

.markdown-content h5,
.markdown-content h6 {
    font-size: 0.9rem;
}

.markdown-content p {
    margin: 0.8em 0;
    line-height: 1.6;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.8em 0;
    padding-left: 2em;
}

.markdown-content li {
    margin: 0.4em 0;
}

.markdown-content strong {
    color: var(--accent-green);
    font-weight: bold;
}

.markdown-content em {
    color: var(--text-primary);
    font-style: italic;
}

.markdown-content code {
    background-color: var(--bg-tertiary);
    color: var(--accent-yellow);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 1em;
    overflow-x: auto;
    margin: 1em 0;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    color: var(--text-primary);
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent-green);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--text-dim);
    font-style: italic;
}

.markdown-content a {
    color: var(--accent-green);
    text-decoration: underline;
    transition: all 0.3s;
}

.markdown-content a:hover {
    text-shadow: 0 0 5px var(--accent-green);
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid var(--border-color);
    padding: 0.5em;
    text-align: left;
}

.markdown-content table th {
    background-color: var(--bg-tertiary);
    color: var(--accent-green);
    font-weight: bold;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5em 0;
}

.decision-content .loading,
.decision-content .no-data,
.decision-content .error {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem;
}

.decision-content .error {
    color: var(--accent-red);
}

/* Account Section */
.account-section {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
}

.account-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-header h2 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.theme-toggle-btn {
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 0.3s;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    white-space: nowrap;
}

.theme-toggle-btn:hover {
    color: var(--accent-green);
    border-color: var(--accent-green);
    box-shadow: 0 0 5px var(--accent-green);
}

.account-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-green);
    text-shadow: 0 0 10px var(--accent-green);
    margin: 1rem 0;
}

.currency-symbol {
    font-size: 2rem;
}

.value-change {
    display: flex;
    gap: 0.5rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.change-amount {
    color: var(--price-up);
}

.change-percent {
    color: var(--text-dim);
}

.change-percent.positive {
    color: var(--price-up);
}

.change-percent.negative {
    color: var(--price-down);
}

.change-amount.negative {
    color: var(--price-down);
}

.account-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.detail-value {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: bold;
}

.detail-value.positive {
    color: var(--profit-color);
}

.detail-value.negative {
    color: var(--loss-color);
}

/* Strategy Info Inline Styles */
.strategy-badge-inline {
    padding: 0.15rem 0.5rem;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-right: 0.5rem;
}

.strategy-badge-inline.ultra-short {
    background-color: #ff9500;
}

.strategy-badge-inline.swing-trend {
    background-color: #00ffaa;
}

.strategy-badge-inline.conservative {
    background-color: #5ac8fa;
}

.strategy-badge-inline.balanced {
    background-color: #ffcc00;
}

.strategy-badge-inline.aggressive {
    background-color: #ff3b30;
}

.strategy-badge-inline.rebate-farming {
    background-color: #af52de;
}

.strategy-info-inline {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: normal;
}

/* Positions Cards - Small cards under account section */
.positions-cards {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.positions-cards-header {
    margin-bottom: 0.8rem;
}

.positions-cards-title {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.positions-cards-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.positions-cards-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 1rem;
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 4px;
}

.position-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.7rem;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.position-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--position-long);
}

.position-card.negative::before {
    background-color: var(--position-short);
}

.position-card:hover {
    border-color: var(--position-long);
}

.position-card.negative:hover {
    border-color: var(--position-short);
}

.position-card-symbol {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-primary);
    flex-shrink: 0;
}

.position-card-pnl {
    font-size: 0.85rem;
    font-weight: bold;
    text-align: right;
}

.position-card-pnl.positive {
    color: var(--profit-color);
}

.position-card-pnl.negative {
    color: var(--loss-color);
}

/* Scrollbar for positions cards */
.positions-cards-container::-webkit-scrollbar {
    width: 4px;
}

.positions-cards-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.positions-cards-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.positions-cards-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Positions Section */
.positions-section {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    max-width: 100%;
    overflow: hidden;
}

.positions-container {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.positions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px;
}

.positions-table thead {
    border-bottom: 1px solid var(--border-color);
}

.positions-table th {
    padding: 0.8rem;
    text-align: left;
    color: var(--text-dim);
    font-weight: bold;
    font-size: 0.85rem;
}

.positions-table td {
    padding: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.positions-table tbody tr {
    transition: background-color 0.2s ease;
}

.positions-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.positions-table .empty-state,
.positions-table .loading {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem;
}

.positions-table td.positive {
    color: var(--profit-color);
    font-weight: bold;
}

.positions-table td.negative {
    color: var(--loss-color);
    font-weight: bold;
}

/* Trades Section */
.trades-section {
    grid-column: 1 / 3;
    grid-row: 4 / 5;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    max-width: 100%;
    overflow: hidden;
}

.section-header {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header #tradesCount {
    color: var(--accent-green);
    font-size: 0.85rem;
    opacity: 0.8;
}

.trades-container {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 700px;
}

.trades-table thead {
    border-bottom: 1px solid var(--border-color);
}

.trades-table th {
    padding: 0.8rem;
    text-align: left;
    color: var(--text-dim);
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.trades-table td {
    padding: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.trades-table tbody tr {
    transition: background-color 0.2s ease;
}

.trades-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.trades-table .empty-state,
.trades-table .loading {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem;
}

/* 交易表格特殊样式 */
.trades-table .symbol {
    color: var(--accent-green);
    font-weight: bold;
}

.trades-table .type {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.trades-table .type.buy {
    background-color: rgba(0, 255, 170, 0.1);
    color: var(--accent-green);
}

.trades-table .type.sell {
    background-color: rgba(255, 82, 82, 0.1);
    color: var(--accent-red);
}

.trades-table .side {
    font-weight: 500;
}

.trades-table .side.long {
    color: var(--position-long);
}

.trades-table .side.short {
    color: var(--position-short);
}

.trades-table .profit {
    color: var(--profit-color);
    font-weight: bold;
}

.trades-table .loss {
    color: var(--loss-color);
    font-weight: bold;
}

.trades-table .na {
    color: var(--text-dim);
    opacity: 0.5;
}

.loading,
.no-data {
    text-align: center;
    color: var(--text-dim);
    padding: 3rem;
    grid-column: 1 / -1;
}

/* Trade Item Styles (from index.html) */
.trade-item {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-green);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.trade-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-green), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.trade-item:hover {
    transform: translateY(-2px);
    border-left-width: 4px;
    border-left-color: var(--accent-green);
    box-shadow: 0 8px 16px rgba(0, 255, 170, 0.2);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.trade-item:hover::before {
    opacity: 1;
}

.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 255, 170, 0.15);
}

.trade-symbol {
    color: var(--accent-green);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 1.5px;
    text-shadow: 0 0 10px rgba(0, 255, 170, 0.4);
    position: relative;
}

.trade-time {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    background: var(--bg-primary);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.trade-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: start;
}

.trade-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 170, 0.1);
    transition: all 0.2s ease;
}

.trade-field:hover {
    border-color: rgba(0, 255, 170, 0.3);
    background: rgba(0, 255, 170, 0.05);
}

.trade-field .label {
    color: var(--text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.trade-field .value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.2);
}

.trade-field .value.long {
    color: var(--accent-red);
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

.trade-field .value.short {
    color: var(--accent-green);
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.3);
}

.trade-field .value.profit {
    color: var(--accent-red);
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

.trade-field .value.loss {
    color: var(--accent-green);
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.3);
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.chat-message {
    margin-bottom: 0.8rem;
    display: flex;
    gap: 0.5rem;
}

.message-prefix {
    color: var(--accent-green);
}

.message-text {
    color: var(--text-secondary);
}

.chat-message.user .message-prefix {
    color: var(--accent-yellow);
}

.chat-input-container {
    display: flex;
    gap: 1rem;
}

.chat-input {
    flex: 1;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--accent-green);
    padding: 0.8rem;
    font-family: inherit;
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 5px var(--border-color);
}

.chat-send-btn {
    background-color: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 0.8rem 2rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.chat-send-btn:hover {
    background-color: var(--accent-green);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--accent-green);
}

/* README */
.readme-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

.readme-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }

    /* 资产曲线 */
    .chart-section:first-child {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        min-height: 400px;
    }

    /* 账户信息 */
    .account-section {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        min-height: auto;
    }

    /* AI 决策 */
    .chart-section:nth-child(2) {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
        min-height: 400px;
    }

    /* 持仓 */
    .positions-section {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
    }

    /* 交易历史 */
    .trades-section {
        grid-column: 1 / 2;
        grid-row: 5 / 6;
    }
}

@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 0.5rem 0.8rem;
        max-width: 100vw;
        overflow: hidden;
    }

    /* 移动端登录按钮 */
    .btn-login {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    /* 移动端弹窗 */
    .modal-content {
        width: 95%;
        max-width: 350px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1.5rem 1rem;
    }

    .password-input {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .modal-footer {
        padding: 0.8rem 1rem;
    }

    .btn-cancel,
    .btn-confirm {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* 移动端平仓按钮 */
    .btn-close-position {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* 移动端 Toast */
    .toast-container {
        top: 60px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
        width: 100%;
        padding: 0.8rem 1rem;
    }

    .toast-title {
        font-size: 0.85rem;
    }

    .toast-message {
        font-size: 0.75rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }

    .nav-bar {
        max-width: 100%;
        overflow: hidden;
        flex-wrap: wrap;
        gap: 0.3rem;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        font-size: 1rem;
        flex-shrink: 0;
    }

    .nav-menu {
        gap: 0.5rem;
        flex-wrap: wrap;
        align-items: center;
    }

    .nav-link,.nav-menu-item {
        font-size: 0.75rem;
        display: flex;
        align-items: center;
    }
    
    /* 移动端去除 LIVE 下面的线 */
    .nav-link.active::after {
        display: none;
    }

    .nav-link svg {
        width: 14px;
        height: 14px;
        margin-right: 2px !important;
    }

    /* 移动端隐藏 GitHub 文字和图标，只保留星数 */
    .github-link > svg {
        display: none;
    }

    .github-link > span:first-of-type {
        display: none;
    }

    .github-stars {
        margin-left: 0;
        padding: 1px 5px;
        font-size: 0.7rem;
    }
    
    .github-stars svg {
        width: 12px;
        height: 12px;
        margin-left: 4px;
        margin-right: 2px;
    }

    .nav-link {
        white-space: nowrap;
    }

    .btn-waitlist {
        display: none;
    }

    /* Ticker */
    .ticker-wrapper {
        padding: 0.4rem 0;
        width: 100%;
    }

    .ticker-content {
        gap: 1.5rem;
    }

    .ticker-item {
        font-size: 0.8rem;
    }

    /* Main Content */
    .main-content {
        padding: 0.6rem;
        gap: 0.6rem;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Chart Section */
    .chart-section {
        padding: 0.8rem;
        min-height: auto;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* 资产曲线保持一定高度 */
    .chart-section:first-child {
        min-height: 350px;
    }

    .chart-container {
        height: auto;
        min-height: 280px;
        padding: 0.4rem;
        max-width: 100%;
        overflow: hidden;
    }
    
    .chart-container canvas {
        height: auto !important;
        width: 100% !important;
    }

    .chart-title,
    .decision-title {
        font-size: 0.85rem;
    }
    
    .chart-header {
        margin-bottom: 0.6rem;
        padding-bottom: 0.4rem;
    }

    .timeframe-select {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .decision-container {
        height: auto;
        min-height: 150px;
        max-height: 400px;
        padding: 0.6rem;
    }

    .decision-text {
        font-size: 0.75rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* 移动端主题切换按钮 */
    .theme-toggle-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .account-header h2 {
        font-size: 0.9rem;
    }

    /* 移动端 Markdown 样式 */
    .markdown-content h1 {
        font-size: 1.1rem;
    }

    .markdown-content h2 {
        font-size: 1rem;
    }

    .markdown-content h3 {
        font-size: 0.95rem;
    }

    .markdown-content h4,
    .markdown-content h5,
    .markdown-content h6 {
        font-size: 0.85rem;
    }

    .markdown-content ul,
    .markdown-content ol {
        padding-left: 1.5em;
    }

    .markdown-content code {
        font-size: 0.75rem;
    }

    .markdown-content pre {
        padding: 0.6em;
        font-size: 0.7rem;
    }

    .markdown-content table {
        font-size: 0.75rem;
    }

    .markdown-content table th,
    .markdown-content table td {
        padding: 0.3em;
    }

    /* Positions Cards */
    .positions-cards {
        margin-top: 0.8rem;
        padding-top: 0.8rem;
    }

    .positions-cards-title {
        font-size: 0.7rem;
    }

    .positions-cards-container {
        max-height: 120px;
        gap: 0.3rem;
    }

    .position-card {
        padding: 0.35rem 0.5rem;
    }

    .position-card-symbol {
        font-size: 0.8rem;
    }

    .position-card-pnl {
        font-size: 0.75rem;
    }

    /* Account Section */
    .account-section {
        padding: 0.8rem;
    }

    .account-value {
        font-size: 1.8rem;
        margin: 0.6rem 0;
    }

    .currency-symbol {
        font-size: 1.3rem;
    }
    
    .account-header {
        margin-bottom: 0.6rem;
    }
    
    .account-details {
        margin-top: 0.8rem;
        padding-top: 0.8rem;
        gap: 0.6rem;
    }

    /* Strategy Info Inline - Mobile */
    .strategy-badge-inline {
        padding: 0.12rem 0.4rem;
        font-size: 0.7rem;
        margin-right: 0.3rem;
    }

    .strategy-info-inline {
        font-size: 0.7rem;
    }

    /* Tables */
    .positions-section,
    .trades-section {
        padding: 0.8rem;
        max-width: 100%;
        overflow: hidden;
    }

    .section-header {
        font-size: 0.85rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.5rem;
    }

    .positions-table,
    .trades-table {
        font-size: 0.7rem;
    }

    .positions-table th,
    .positions-table td,
    .trades-table th,
    .trades-table td {
        padding: 0.35rem 0.2rem;
        white-space: nowrap;
    }

    /* 移动端隐藏持仓表格的一些列 */
    .positions-table th:nth-child(3),
    .positions-table td:nth-child(3),
    .positions-table th:nth-child(4),
    .positions-table td:nth-child(4),
    .positions-table th:nth-child(5),
    .positions-table td:nth-child(5),
    .positions-table th:nth-child(6),
    .positions-table td:nth-child(6) {
        display: none;
    }

    /* 移动端操作列保持显示 */
    .th-actions,
    .td-actions {
        display: table-cell;
    }

    /* 移动端隐藏交易历史表格的一些列 - 隐藏价格，显示数量（开仓价值） */
    .trades-table th:nth-child(5),
    .trades-table td:nth-child(5),
    .trades-table th:nth-child(7),
    .trades-table td:nth-child(7),
    .trades-table th:nth-child(8),
    .trades-table td:nth-child(8) {
        display: none;
    }

    .trades-container {
        max-height: 450px;
        max-width: 100%;
    }

    .trade-item {
        padding: 1rem;
    }

    .trade-symbol {
        font-size: 1rem;
    }

    .trade-time {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .trade-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .trade-field {
        padding: 0.4rem;
    }

    .trade-field .label {
        font-size: 0.7rem;
    }
    
    .trade-field .value {
        font-size: 0.9rem;
    }

    .tabs-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .header {
        padding: 0.4rem 0.6rem;
    }

    .nav-bar {
        gap: 0.3rem;
    }

    .logo {
        font-size: 0.9rem;
    }

    .nav-link {
        font-size: 0.65rem;
    }

    .github-stars {
        padding: 1px 3px;
        font-size: 0.6rem;
    }
    
    .github-stars svg {
        width: 10px;
        height: 10px;
        margin-left: 3px;
        margin-right: 1px;
    }
    
    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .chart-section {
        padding: 0.6rem;
        min-height: auto;
    }
    
    /* 资产曲线保持一定高度 */
    .chart-section:first-child {
        min-height: 300px;
    }

    .account-section {
        padding: 0.6rem;
    }

    .account-value {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }

    .currency-symbol {
        font-size: 1.2rem;
    }

    .chart-container {
        height: auto;
        min-height: 240px;
        padding: 0.3rem;
        max-width: 100%;
        overflow: hidden;
    }
    
    .chart-container canvas {
        height: auto !important;
        width: 100% !important;
    }
    
    .decision-container {
        height: auto;
        min-height: 120px;
        max-height: 350px;
        padding: 0.5rem;
    }

    .positions-table,
    .trades-table {
        min-width: auto;
        font-size: 0.65rem;
    }

    .positions-table th,
    .positions-table td,
    .trades-table th,
    .trades-table td {
        font-size: 0.65rem;
        padding: 0.3rem 0.15rem;
        white-space: nowrap;
    }
    
    .positions-section,
    .trades-section {
        padding: 0.6rem;
    }
    
    .section-header {
        font-size: 0.8rem;
        margin-bottom: 0.6rem;
        padding-bottom: 0.4rem;
    }

    /* 移动端主题切换按钮 */
    .theme-toggle-btn {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
    
    .theme-toggle-btn span {
        display: inline-block;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .account-header h2 {
        font-size: 0.85rem;
    }

    /* 继承768px的列隐藏规则 */
    .positions-table th:nth-child(3),
    .positions-table td:nth-child(3),
    .positions-table th:nth-child(4),
    .positions-table td:nth-child(4),
    .positions-table th:nth-child(5),
    .positions-table td:nth-child(5),
    .positions-table th:nth-child(6),
    .positions-table td:nth-child(6) {
        display: none;
    }

    /* 移动端操作列保持显示 */
    .th-actions,
    .td-actions {
        display: table-cell;
    }

    /* 移动端登录按钮 */
    .btn-login {
        padding: 0.35rem 0.7rem;
        font-size: 0.7rem;
    }

    /* 移动端平仓按钮 */
    .btn-close-position {
        padding: 0.2rem 0.4rem;
        font-size: 0.65rem;
    }

    .trades-table th:nth-child(5),
    .trades-table td:nth-child(5),
    .trades-table th:nth-child(7),
    .trades-table td:nth-child(7),
    .trades-table th:nth-child(8),
    .trades-table td:nth-child(8) {
        display: none;
    }
    
    .trades-container {
        max-height: 350px;
    }
    
    .trade-item {
        padding: 0.6rem;
    }
    
    .trade-header {
        margin-bottom: 0.6rem;
        padding-bottom: 0.6rem;
    }
    
    .trade-symbol {
        font-size: 0.85rem;
    }
    
    .trade-info {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .trade-field {
        padding: 0.3rem;
    }
    
    .trade-field .label {
        font-size: 0.6rem;
    }
    
    .trade-field .value {
        font-size: 0.8rem;
    }
}

/* Section Header with Action Button */
.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header-with-action .section-header {
    margin: 0;
    padding: 0;
    border: none;
}

/* Login Button */
.btn-login {
    background-color: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 0.35rem 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
}

.btn-login:hover {
    background-color: var(--accent-green);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--accent-green);
}

.btn-login.logged-in {
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

.btn-login.logged-in:hover {
    background-color: var(--accent-yellow);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--accent-yellow);
}

/* Action Column */
.th-actions {
    text-align: center;
    min-width: 80px;
}

.td-actions {
    text-align: center;
}

/* Close Position Button */
.btn-close-position {
    background-color: transparent;
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 0.3rem 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 3px;
    white-space: nowrap;
}

.btn-close-position:hover {
    background-color: var(--accent-red);
    color: var(--bg-primary);
    box-shadow: 0 0 8px var(--accent-red);
}

.btn-close-position:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--text-dim);
    color: var(--text-dim);
}

.btn-close-position:disabled:hover {
    background-color: transparent;
    box-shadow: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background-color: var(--bg-tertiary);
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.modal-header h3 {
    color: var(--accent-green);
    margin: 0;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(0, 255, 170, 0.3);
}

.modal-close {
    color: var(--text-dim);
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
    border: none;
    background: none;
}

.modal-close:hover {
    color: var(--accent-red);
    text-shadow: 0 0 10px var(--accent-red);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem 1.5rem;
}

.password-input {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--accent-green);
    padding: 0.8rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    border-radius: 4px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.password-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 255, 170, 0.2);
}

.modal-hint {
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 0.8rem;
    margin-bottom: 0;
    line-height: 1.4;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    border-radius: 0 0 6px 6px;
}

.btn-cancel,
.btn-confirm {
    padding: 0.6rem 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid;
}

.btn-cancel {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    box-shadow: 0 0 5px var(--border-color);
}

.btn-confirm {
    background-color: transparent;
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-confirm:hover {
    background-color: var(--accent-green);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--accent-green);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 255, 170, 0.3);
    pointer-events: all;
    animation: toastSlideIn 0.3s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
}

.toast.toast-success {
    border-color: var(--accent-green);
    box-shadow: 0 4px 20px rgba(0, 255, 170, 0.4);
}

.toast.toast-error {
    border-color: var(--accent-red);
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
}

.toast.toast-warning {
    border-color: var(--accent-yellow);
    box-shadow: 0 4px 20px rgba(255, 255, 0, 0.4);
}

.toast.toast-info {
    border-color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 204, 136, 0.4);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.toast-removing {
    animation: toastSlideOut 0.3s ease-out forwards;
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.toast-success .toast-icon {
    color: var(--accent-green);
}

.toast-error .toast-icon {
    color: var(--accent-red);
}

.toast-warning .toast-icon {
    color: var(--accent-yellow);
}

.toast-info .toast-icon {
    color: var(--text-primary);
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.toast-title {
    color: var(--accent-green);
    font-weight: bold;
    font-size: 0.95rem;
    margin: 0;
}

.toast-success .toast-title {
    color: var(--accent-green);
}

.toast-error .toast-title {
    color: var(--accent-red);
}

.toast-warning .toast-title {
    color: var(--accent-yellow);
}

.toast-info .toast-title {
    color: var(--text-primary);
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
}

.toast-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem;
    transition: all 0.2s;
}

.toast-close:hover {
    color: var(--accent-red);
    transform: scale(1.2);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-green);
}

